/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.tencent.tendon.convert.jsontest.record;

import com.tencent.tendon.convert.json.JsonConvert;
import com.tencent.tendon.convert.util.GenericType;
import java.lang.reflect.Type;
import java.util.*;

/**
 *
 * @author nbzhang
 */
public class CaseRecord {

	private static Type Type_List_Integer = new GenericType<List<Integer>>() {}.getType();

	private static Type Type_List_Map_1 = new GenericType<List<Map<Integer, String>>>() {}.getType();

	private static Type Type_Array_List_Map_1 = new GenericType<List<Map<Integer, String>>[]>() {}.getType();

	public static void main(String[] args) throws Throwable {
		String str1 = "[{1:'a',2:'b'},{3:'c',4:'d'}]";
		List<Map<Integer, String>> value1 = JsonConvert.convertFrom(str1, Type_List_Map_1);
        System.out.println(value1);
        List<Integer> value2 = JsonConvert.convertFrom("[1,2,3,4,5]", Type_List_Integer);
		System.out.println(value2);
        
		String str2 = "[" + str1 + "]";
		List<Map<Integer, String>>[] obj2 = JsonConvert.convertFrom(str2, Type_Array_List_Map_1);
		System.out.println(JsonConvert.convertTo(obj2));
		List<Map<Integer, String>>[] obj3 = JsonConvert.convertArrayFrom(str2, Type_List_Map_1);
		System.out.println(JsonConvert.convertTo(obj3));
	}
}
